﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;

namespace DCS7GUI
{
    public class GUIRText : IDCSGUI
    {
        public string Text { get; set; }
        public byte X
        {
            get;
            set;
        }
        public byte Y
        {
            get;
            set;
        }
        public byte Width
        {
            get
            {
                return (byte)Helpers.TextWidth(Text);
            }
            set
            {
            }
        }
        public byte Height
        {
            get
            {
                return 6;
            }
            set
            {
            }
        }

        public byte Size
        {
            get { return (byte)(7 + Text.Length); }
        }

        public byte Type
        {
            get { return 4; }
        }

        public string Data
        {
            get
            {
                return X.ToString() + "\n" +
                    Y.ToString() + "\n0\n" +
                    Text;
            }
        }

        public GUIRText()
        {
            Text = "Text";
        }

        public Bitmap Render(Bitmap image, int offsetX, int offsetY)
        {
            Helpers.DrawText(X + offsetX, Y + 1 + offsetY, Text, image);
            return image;
        }

        public IGUIContainer Parent { get; set; }
    }
}
